﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;

namespace Jizsoft.JFrame.Identity.Domain
{
    public class JFDbContext : DbContext
    {
        static JFDbContext()
        {
            Database.SetInitializer<JFDbContext>(null);
        }

        public JFDbContext()
            : base("name=identity-db")
        {
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Entities.User>().ToTable("JF_T_User");
            modelBuilder.Entity<Entities.User>().HasKey(t => t.Id);

            modelBuilder.Entity<Entities.IllegalPassword>().ToTable("JF_T_IllegalPassword");
            modelBuilder.Entity<Entities.IllegalPassword>().HasKey(t => t.Id);

            //modelBuilder.Entity<CMS.Domain.Entities.Category>().ToTable("cms_t_category");
            //modelBuilder.Entity<CMS.Domain.Entities.Category>().HasKey(p => p.Id);

            //modelBuilder.Entity<CMS.Domain.Entities.ArticleCategory>().ToTable("cms_t_articlecategory");
            //modelBuilder.Entity<CMS.Domain.Entities.ArticleCategory>().HasKey(p => new { p.ArticleId, p.CategoryId });

            //modelBuilder.Entity<CMS.Domain.Entities.MediaFile>().ToTable("cms_t_mediafile");
            //modelBuilder.Entity<CMS.Domain.Entities.MediaFile>().HasKey(p => p.Id);

            //do something
            base.OnModelCreating(modelBuilder);
        }
    }
}
